#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;
int cnt1, cnt2;
int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int i = 0;
	while (i < n)
	{
		if (s[i] == 'b')
		{
			if (s[i + 1] == 'o')
				i++;
			else
			{
				cnt1++;
				i++;
			}
		}
		else if (s[i] == 'o')
		{
			if (s[i + 1] == 'y')
				i++;
			else
			{
				cnt1++;
				i++;
			}
		}
		else if (s[i] == 'y')
		{
			cnt1++;
			i++;
		}
		else if (s[i] == 'g')
		{
			if (s[i + 1] == 'i')
				i++;
			else
			{
				cnt2++;
				i++;
			}
		}
		else if (s[i] == 'i')
		{
			if (s[i + 1] == 'r')
				i++;
			else
			{
				cnt2++;
				i++;
			}
		}
		else if (s[i] == 'r')
		{
			if (s[i + 1] == 'l')
				i++;
			else
			{
				cnt2++;
				i++;
			}
		}
		else if (s[i] == 'l')
		{
			cnt2++;
			i++;
		}
		else if(s[i]=='.')
			i++;
	}
	cout << cnt1 << endl << cnt2 << endl;
	return 0;
}